"use strict";
const a = require("../../common/vendor.js"),
  e = require("../../api/request.js"),
  t = require("../../api/qq-Location.js"),
  u = require("../../api/debounceapi.js"),
  c = require("../../store/index.js");
require("../../api/qqmap-wx-jssdk.js"), require("../../api/my-account.js");
const i = {
    __name: "city",
    setup(i) {
      const o = c.dataSet();
      a.ref(0);
      const n = a.ref("定位中"),
        r = a.ref([]),
        d = a.ref([{
          title: "本月热门",
          data: []
        }, {
          title: "自由行必去",
          data: []
        }, {
          title: "热度飙升",
          data: []
        }]),
        l = a.ref(!0);
      a.onMounted((async () => {
        const u = a.wx$1.getStorageSync("location");
        if (u) n.value = u;
        else {
          const e = await t.getLocation();
          n.value = e.city, a.wx$1.setStorageSync("location", e.city)
        }
        const c = await e.requestApi("/country_class"),
          i = await e.requestApi("/choose_address", {
            type: "AAA"
          });
        r.value = c.data, console.log(r.value), d.value[0].data = i.data.currentMonth, d.value[1].data = i.data.freedom, d.value[2].data = i.data.heatCity
      }));
      const s = a.ref([]),
        v = a.ref(0);
      const f = a.ref(!0),
        y = a.ref(""),
        p = a.ref([]),
        q = u.debounceapi((async () => {
          f.value = "" == y.value;
          const a = await e.requestApi("/china_data", {
            keywords: y.value
          });
          p.value = a.data
        }));
      async function m() {
        f.value = "" == y.value
      }

      function g(e) {
        o.$patch({
          address: e
        }), a.index.navigateBack({
          delta: 1
        })
      }
      return (t, u) => a.e({
        a: a.o([a => y.value = a.detail.value, (...e) => a.unref(q) && a.unref(q)(...e)]),
        b: a.o(m),
        c: y.value,
        d: a.f(r.value, ((t, u, c) => ({
          a: a.t(t.country),
          b: u,
          c: a.n(v.value === u ? "activeTab" : ""),
          d: a.o((a => async function (a, t) {
            v.value = t;
            const u = await e.requestApi("/choose_address", {
              type: a
            });
            "AAA" == a ? (d.value[0].data = u.data.currentMonth, d.value[1].data = u.data.freedom, d.value[2].data = u.data.heatCity, l.value = !0) : (s.value = u.data, l.value = !1)
          }(t.type, u)), u)
        }))),
        e: l.value
      }, l.value ? {
        f: a.t(n.value),
        g: a.o((a => g(n.value))),
        h: a.f(d.value, ((e, t, u) => a.e({
          a: e.data.length > 0
        }, e.data.length > 0 ? {
          b: a.t(e.title)
        } : {}, {
          c: a.f(e.data, ((e, t, u) => ({
            a: e.image,
            b: a.t(e._id),
            c: t,
            d: a.o((a => g(e._id)), t)
          }))),
          d: t
        })))
      } : {}, {
        i: !l.value
      }, l.value ? {} : {
        j: a.f(s.value, ((e, t, u) => ({
          a: e.image,
          b: a.t(e.city),
          c: t,
          d: a.o((a => g(e.city)), t)
        })))
      }, {
        k: f.value,
        l: a.f(p.value, ((e, t, u) => ({
          a: a.t(e.provinceName),
          b: a.o((a => g(e.provinceName)), t),
          c: a.f(e.citys, ((e, u, c) => ({
            a: a.t(e.cityName),
            b: a.o((a => g(e.cityName)), t)
          }))),
          d: t,
          e: t
        }))),
        m: !f.value
      })
    }
  },
  o = a._export_sfc(i, [
    ["__scopeId", "data-v-7303987c"]
  ]);
wx.createPage(o);